﻿<?php
require_once('konfiguration.html');

//$files=array("hungarian"=>"hungarisch10000.txt");
$files=array("russian"=>"5000ru.txt");
foreach ($files as $key=> $value)
{
   $lines=file($value);
   print "$key";
   foreach($lines as $line)
   { 
      preg_match_all('/[^ ]+/',$line,$matches,PREG_PATTERN_ORDER);
	  print_r($matches);
	  if ($matches[1]) $line_correct=$matches[0][1];
	  else $line_correct=$matches[0][0];
	  //print htmlentities($line_correct[0]).'<br>';
	  //print "Добро пожаловать!";
      
	 // print $line_correct.'<br>';
	 
      mysql_query("INSERT INTO mostcommonwords VALUES ('$key','$line_correct',$index)");
	  //mysql_query("INSERT INTO mostcommonwords VALUES ('$key','русский алфави',$index)");
	  $index+=1;
	  set_time_limit(30);
   
   }

}

//DELETE FROM `mostcommonwords` WHERE language='russian'

?>